<?php

class ChangePwdAction extends CAction{

	public $modelName = 'UpdatePwdForm';
	public $memberModel;
	public $memberId;
	public $view;
	public $layout;
	public $returnUrl;
	public function run() {
		$c = $this->controller;
		$c->layout = $this->layout;
		$modelName = $this->modelName;
		$model = new $modelName();
		$model->memberModel = $this->memberModel;
		$model->memberId = $this->memberId;
		if (isset($_POST[$modelName])) {
			$model->attributes = $_POST[$modelName];
			if ($model->validate() && $model->save()) {
//				$c->refresh();
				Yii::app()->user->setFlash(FLASH::RESULT_SUCCESS, ' 修改成功！');
				$c->redirect($this->returnUrl);
			}
		}
		
		$c->render($this->view,array('model'=>$model));
	}
}

?>